package com.acegear.horizon.domain.repository.jpa;

import java.util.List;
import java.util.Optional;

import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.acegear.horizon.domain.models.jpa.UserFollow;

/**
 * Created by wangsike on 2016/12/22.
 */
public interface UserFollowRepository extends PagingAndSortingRepository<UserFollow, Long> {
    Optional<UserFollow> findTopByFolloweeIdAndFollowerId(Long followeeId, Long followerId);

    void deleteByFolloweeIdAndFollowerId(Long followeeId, Long followerId);

    List<UserFollow> findByFollowerId(Long followerId, Pageable pageable);

    List<UserFollow> findByFolloweeId(Long followeeId, Pageable pageable);

    Integer countByFollowerId(Long followerId);

    Integer countByFolloweeId(Long followeeId);

    boolean existsByFolloweeId(Long followeeId);
}
